#include "qcprintform.h"
#include "ui_qcprintform.h"
#include <QChart>
QcPrintForm::QcPrintForm(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::QcPrintForm)
{
    ui->setupUi(this);
    QVector<double> data = {-2, 1, 3, -1};
    QString qcName = "QC Name";
    QString qcLot = "QC Lot";
    QString testItem = "Test Item";
    double target = 2.5;
    double sd = 1.2;
    double mean = 1.8;
    double cv = 0.3;

    m_chart = new CustomChart(data);

    ui->layout_chart->addWidget(m_chart);

}

QcPrintForm::~QcPrintForm()
{
    delete ui;
}

void QcPrintForm::setData(const QcPrintFormData &data)
{
    ui->lbl_qcName->setText(data.qcName);
    ui->lbl_qcLot->setText(data.qcLot);
    ui->lbl_testItem->setText(data.testItem);
    ui->lbl_target->setText(QString::number(data.target));
    ui->lbl_sd->setText(QString::number(data.sd));
    ui->lbl_mean->setText(QString::number(data.mean));
    ui->lbl_cv->setText(QString::number(data.cv));
    ui->lbl_no->setText(QString::number(data.no));
    ui->lbl_result->setText(QString::number(data.reuslt));
    ui->lbl_time->setText(data.strDateTime);
    ui->lbl_page->setText(QString::number(data.currentPage)+"/"+QString::number(data.totalPage));
    m_chart->setData(data.data);
}
